home *** CD-ROM | disk | FTP | other *** search
- Path: news.mindlink.net!news
- From: genew@mindlink.bc.ca (Gene Wirchenko)
- Newsgroups: comp.lang.c
- Subject: Re: division problem
- Date: Wed, 31 Jan 1996 05:21:12 GMT
- Organization: MIND LINK! - British Columbia, Canada
- Message-ID: <4emuba$1mo@fountain.mindlink.net>
- References: <31097D77.11AA@rain.org> <26JAN199622082450@erich.triumf.ca> <4eh246$u6h@airdmhor.gen.nz> <4ej4ha$66@fountain.mindlink.net> <DLzvGG.2rn@uns.bris.ac.uk>
- NNTP-Posting-Host: line349.nwm.mindlink.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- nathan@pact.srf.ac.uk (Nathan Sidwell) wrote:
-
- >Gene Wirchenko (genew@mindlink.bc.ca) wrote:
- >: gumboot@airdmhor.gen.nz (Simon Hosie) wrote:
-
- >: >celcius = (fahrenheit - 32) * 5 / 9;
-
- >: That's disgusting <g> as it doesn't round. Try it with 39 deg F:
- >: (39-32)*5/9 ::= 7*5/9 ::= 35/9 ::= 3
- >: but the actual value is 3.8... i.e. nearly 4. If you must int, 4
- >: would be a better answer.
-
- >Still no need to use floating point,
- >celcius = ((fahrenheit - 32) * 5 + 4) / 9
-
- Let's assume that you had never run across fahrenheit to celsius
- conversion before (because the above could just as easily be a case of
- converting flibbles to meeblesnauzers).
-
- Can you derive the ORIGINAL formula for conversion of F to C?
-
- If yes, how? Because you don't know what the 4 is for.
-
- If no, then it's unclear code, isn't it?
-
- [sigsnip]
-
- Sincerely,
-
- Gene Wirchenko
-
- C Pronunciation Guide:
- y=x++; "wye equals ex plus plus semicolon"
- x=x++; "ex equals ex doublecross semicolon"
-
-